package com.gy.common;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.Map;

/**
 * 配电设施 地市对应关系
 */
@Component
public class PdCityMap {
    private static final Map<String, String> CITY_CODE = new HashMap<>();
    private static final Map<String, String> CITY_CODE2 = new HashMap<>();
    private static final Map<String, String> CITY_STRING = new HashMap<>();
    private static final Map<String, String> CITY_JC = new HashMap<>();
    private static final Map<String, String> CITY_JC2 = new HashMap<>();
    private static final Map<String, String> GET_WTLX = new HashMap<>();


    @PostConstruct
    private void init() {
        CITY_CODE.put("214001", "14383AB1ACD9422DE0541CC1DE1077D5");
        CITY_CODE.put("214002", "14383AB1AF01422DE0541CC1DE1077D5");
        CITY_CODE.put("214003", "14383AB1B255422DE0541CC1DE1077D5");
        CITY_CODE.put("214004", "14383AB1B0EA422DE0541CC1DE1077D5");
        CITY_CODE.put("214005", "14383AB1B39E422DE0541CC1DE1077D5");
        CITY_CODE.put("214006", "14383AB1B76B422DE0541CC1DE1077D5");
        CITY_CODE.put("214007", "14383AB1BA50422DE0541CC1DE1077D5");
        CITY_CODE.put("214008", "14383AB1B4BE422DE0541CC1DE1077D5");
        CITY_CODE.put("214009", "14383AB1B665422DE0541CC1DE1077D5");
        CITY_CODE.put("214010", "14383AB1B91D422DE0541CC1DE1077D5");
        CITY_CODE.put("214011", "14383AB1B821422DE0541CC1DE1077D5");
        CITY_CODE.put("214012", "14383AB1BB01422DE0541CC1DE1077D5");
        CITY_CODE.put("214013", "14383AB1B9D0422DE0541CC1DE1077D5");
        CITY_CODE.put("214014", "14383AB1BC21422DE0541CC1DE1077D5");

        CITY_CODE2.put("14383AB1ACD9422DE0541CC1DE1077D5", "214001");
        CITY_CODE2.put("14383AB1AF01422DE0541CC1DE1077D5", "214002");
        CITY_CODE2.put("14383AB1B255422DE0541CC1DE1077D5", "214003");
        CITY_CODE2.put("14383AB1B0EA422DE0541CC1DE1077D5", "214004");
        CITY_CODE2.put("14383AB1B39E422DE0541CC1DE1077D5", "214005");
        CITY_CODE2.put("14383AB1B76B422DE0541CC1DE1077D5", "214006");
        CITY_CODE2.put("14383AB1BA50422DE0541CC1DE1077D5", "214007");
        CITY_CODE2.put("14383AB1B4BE422DE0541CC1DE1077D5", "214008");
        CITY_CODE2.put("14383AB1B665422DE0541CC1DE1077D5", "214009");
        CITY_CODE2.put("14383AB1B91D422DE0541CC1DE1077D5", "214010");
        CITY_CODE2.put("14383AB1B821422DE0541CC1DE1077D5", "214011");
        CITY_CODE2.put("14383AB1BB01422DE0541CC1DE1077D5", "214012");
        CITY_CODE2.put("14383AB1B9D0422DE0541CC1DE1077D5", "214013");
        CITY_CODE2.put("14383AB1BC21422DE0541CC1DE1077D5", "214014");


        CITY_JC.put("SY", "14383AB1ACD9422DE0541CC1DE1077D5");
        CITY_JC.put("DL", "14383AB1AF01422DE0541CC1DE1077D5");
        CITY_JC.put("FS", "14383AB1B255422DE0541CC1DE1077D5");
        CITY_JC.put("AS", "14383AB1B0EA422DE0541CC1DE1077D5");
        CITY_JC.put("BX", "14383AB1B39E422DE0541CC1DE1077D5");
        CITY_JC.put("YK", "14383AB1B76B422DE0541CC1DE1077D5");
        CITY_JC.put("TL", "14383AB1BA50422DE0541CC1DE1077D5");
        CITY_JC.put("DD", "14383AB1B4BE422DE0541CC1DE1077D5");
        CITY_JC.put("JZ", "14383AB1B665422DE0541CC1DE1077D5");
        CITY_JC.put("LY", "14383AB1B91D422DE0541CC1DE1077D5");
        CITY_JC.put("FX", "14383AB1B821422DE0541CC1DE1077D5");
        CITY_JC.put("CY", "14383AB1BB01422DE0541CC1DE1077D5");
        CITY_JC.put("PJ", "14383AB1B9D0422DE0541CC1DE1077D5");
        CITY_JC.put("HLD", "14383AB1BC21422DE0541CC1DE1077D5");

        CITY_JC2.put("14383AB1ACD9422DE0541CC1DE1077D5", "SY");
        CITY_JC2.put("14383AB1AF01422DE0541CC1DE1077D5", "DL");
        CITY_JC2.put("14383AB1B255422DE0541CC1DE1077D5", "FS");
        CITY_JC2.put("14383AB1B0EA422DE0541CC1DE1077D5", "AS");
        CITY_JC2.put("14383AB1B39E422DE0541CC1DE1077D5", "BX");
        CITY_JC2.put("14383AB1B76B422DE0541CC1DE1077D5", "YK");
        CITY_JC2.put("14383AB1BA50422DE0541CC1DE1077D5", "TL");
        CITY_JC2.put("14383AB1B4BE422DE0541CC1DE1077D5", "DD");
        CITY_JC2.put("14383AB1B665422DE0541CC1DE1077D5", "JZ");
        CITY_JC2.put("14383AB1B91D422DE0541CC1DE1077D5", "LY");
        CITY_JC2.put("14383AB1B821422DE0541CC1DE1077D5", "FX");
        CITY_JC2.put("14383AB1BB01422DE0541CC1DE1077D5", "CY");
        CITY_JC2.put("14383AB1B9D0422DE0541CC1DE1077D5", "PJ");
        CITY_JC2.put("14383AB1BC21422DE0541CC1DE1077D5", "HLD");

        CITY_STRING.put("14383AB1ACD9422DE0541CC1DE1077D5", "沈阳");
        CITY_STRING.put("14383AB1AF01422DE0541CC1DE1077D5", "大连");
        CITY_STRING.put("14383AB1B255422DE0541CC1DE1077D5", "抚顺");
        CITY_STRING.put("14383AB1B0EA422DE0541CC1DE1077D5", "鞍山");
        CITY_STRING.put("14383AB1B39E422DE0541CC1DE1077D5", "本溪");
        CITY_STRING.put("14383AB1B76B422DE0541CC1DE1077D5", "营口");
        CITY_STRING.put("14383AB1BA50422DE0541CC1DE1077D5", "铁岭");
        CITY_STRING.put("14383AB1B4BE422DE0541CC1DE1077D5", "丹东");
        CITY_STRING.put("14383AB1B665422DE0541CC1DE1077D5", "锦州");
        CITY_STRING.put("14383AB1B91D422DE0541CC1DE1077D5", "辽阳");
        CITY_STRING.put("14383AB1B821422DE0541CC1DE1077D5", "阜新");
        CITY_STRING.put("14383AB1BB01422DE0541CC1DE1077D5", "朝阳");
        CITY_STRING.put("14383AB1B9D0422DE0541CC1DE1077D5", "盘锦");
        CITY_STRING.put("14383AB1BC21422DE0541CC1DE1077D5", "葫芦岛");
        CITY_STRING.put("14383AB1BE1C422DE0541CC1DE1077D5", "国网辽宁省电力有限公司检修分公司");

        GET_WTLX.put("01", "ZBZZ");
        GET_WTLX.put("02", "ZBGZ");
        GET_WTLX.put("03", "XLZZ");
        GET_WTLX.put("04", "XLGZ");
        GET_WTLX.put("05", "BDZZZ");
        GET_WTLX.put("06", "BDZGZ");
        GET_WTLX.put("07", "ZBBMZNJ1");
        GET_WTLX.put("08", "DXBDZ");
        GET_WTLX.put("09", "DBBDZ");
        GET_WTLX.put("10", "DXQDBBDZ");
        GET_WTLX.put("11", "BMZFHZDDLLX");
        GET_WTLX.put("12", "XLBMZNJ1");
        GET_WTLX.put("13", "PBZZ");
        GET_WTLX.put("14", "PBGZ");
        GET_WTLX.put("15", "XLZZ");
        GET_WTLX.put("16", "XLGZ");
        GET_WTLX.put("17", "XLBMZNJ1");
        GET_WTLX.put("18", "DFSXL");
        GET_WTLX.put("19", "BMZNJ1JYLLXL");
        GET_WTLX.put("20", "PFTD");
        GET_WTLX.put("21", "TQDDY");
    }


    public static String getByCityString(String cityCode) {
        return CITY_STRING.get(cityCode);
    }


    public static String getByCityCode(String cityCode) {
        return CITY_CODE.get(cityCode);
    }

    public static String getByCityCode2(String cityCode) {
        return CITY_CODE2.get(cityCode);
    }

    public static String getByCityJc(String cityCode) {
        return CITY_JC.get(cityCode);
    }

    public static String getByCityJc2(String cityCode) {
        return CITY_JC2.get(cityCode);
    }

    public static String getWtlx(String code) {
        return GET_WTLX.get(code);
    }

    /**
     * 文字包含转换
     */
    public static String getInclude(String cityName) {
        if (cityName.contains("沈阳")) {
            return "214001";
        } else if (cityName.contains("大连")) {
            return "214002";
        } else if (cityName.contains("抚顺")) {
            return "214003";
        } else if (cityName.contains("鞍山")) {
            return "214004";
        } else if (cityName.contains("本溪")) {
            return "214005";
        } else if (cityName.contains("营口")) {
            return "214006";
        } else if (cityName.contains("铁岭")) {
            return "214007";
        } else if (cityName.contains("丹东")) {
            return "214008";
        } else if (cityName.contains("锦州")) {
            return "214009";
        } else if (cityName.contains("辽阳")) {
            return "214010";
        } else if (cityName.contains("阜新")) {
            return "214011";
        } else if (cityName.contains("朝阳")) {
            return "214012";
        } else if (cityName.contains("盘锦")) {
            return "214013";
        } else if (cityName.contains("葫芦岛")) {
            return "214014";
        }
        return null;
    }
}
